package org.cc.cloud.hystrix;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

@Controller
public class HystrixController {
	@Autowired
	private HystrixService hystrixService;
	
	@GetMapping("/helloByHystrix")
	@ResponseBody
	public String rouler(){
	 
		for(int i=0;i<100;i++){
			 hystrixService.getCache(1);
		}
		 
		return "";
	}
	//缓存测试(参数一样‘1’才可以设置缓存或清除缓存)
	@GetMapping("/hystrixCache")
	@ResponseBody
	public String hystrixCache(){
	 
		 hystrixService.getCache(1);
		 hystrixService.getCache(1);
		 hystrixService.removeCache(1);
		 hystrixService.getCache(1);
		return "";
	}
}
